package generalpattern.diagram.navigator;

import generalpattern.diagram.edit.parts.Component2EditPart;
import generalpattern.diagram.edit.parts.Component3EditPart;
import generalpattern.diagram.edit.parts.ComponentEditPart;
import generalpattern.diagram.edit.parts.ComponentName2EditPart;
import generalpattern.diagram.edit.parts.ComponentName3EditPart;
import generalpattern.diagram.edit.parts.ComponentNameEditPart;
import generalpattern.diagram.edit.parts.ComponentPortAttachedRoleEditPart;
import generalpattern.diagram.edit.parts.ComponentPortDelegatedPortsEditPart;
import generalpattern.diagram.edit.parts.ComponentPortEditPart;
import generalpattern.diagram.edit.parts.Connector2EditPart;
import generalpattern.diagram.edit.parts.Connector3EditPart;
import generalpattern.diagram.edit.parts.ConnectorEditPart;
import generalpattern.diagram.edit.parts.ConnectorName2EditPart;
import generalpattern.diagram.edit.parts.ConnectorName3EditPart;
import generalpattern.diagram.edit.parts.ConnectorNameEditPart;
import generalpattern.diagram.edit.parts.ConnectorRoleDelegatedRolesEditPart;
import generalpattern.diagram.edit.parts.ConnectorRoleEditPart;
import generalpattern.diagram.edit.parts.ConstraintEditPart;
import generalpattern.diagram.edit.parts.ConstraintNameEditPart;
import generalpattern.diagram.edit.parts.ElementMultiplicityEditPart;
import generalpattern.diagram.edit.parts.ElementRolesEditPart;
import generalpattern.diagram.edit.parts.MergingOperatorSourceEditPart;
import generalpattern.diagram.edit.parts.MergingOperatorTargetEditPart;
import generalpattern.diagram.edit.parts.Multiplicity2EditPart;
import generalpattern.diagram.edit.parts.MultiplicityEditPart;
import generalpattern.diagram.edit.parts.Overlapping2EditPart;
import generalpattern.diagram.edit.parts.OverlappingEditPart;
import generalpattern.diagram.edit.parts.Pattern2EditPart;
import generalpattern.diagram.edit.parts.Pattern3EditPart;
import generalpattern.diagram.edit.parts.Pattern4EditPart;
import generalpattern.diagram.edit.parts.PatternEditPart;
import generalpattern.diagram.edit.parts.PatternName2EditPart;
import generalpattern.diagram.edit.parts.PatternName3EditPart;
import generalpattern.diagram.edit.parts.PatternNameEditPart;
import generalpattern.diagram.edit.parts.Role2EditPart;
import generalpattern.diagram.edit.parts.RoleEditPart;
import generalpattern.diagram.edit.parts.RoleName2EditPart;
import generalpattern.diagram.edit.parts.RoleNameEditPart;
import generalpattern.diagram.edit.parts.Stringing2EditPart;
import generalpattern.diagram.edit.parts.StringingEditPart;
import generalpattern.diagram.part.GeneralPatternMetamodelDiagramEditorPlugin;
import generalpattern.diagram.part.GeneralPatternMetamodelVisualIDRegistry;
import generalpattern.diagram.providers.GeneralPatternMetamodelElementTypes;
import generalpattern.diagram.providers.GeneralPatternMetamodelParserProvider;

import org.admanager.generalpattern.plugin.generalpattern.ComponentPort;
import org.admanager.generalpattern.plugin.generalpattern.ConnectorRole;
import org.admanager.generalpattern.plugin.generalpattern.Multiplicity;
import org.admanager.generalpattern.plugin.generalpattern.Overlapping;
import org.admanager.generalpattern.plugin.generalpattern.Pattern;
import org.admanager.generalpattern.plugin.generalpattern.Stringing;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.viewers.ITreePathLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.ViewerLabel;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
import org.eclipse.ui.navigator.ICommonLabelProvider;

/**
 * @generated
 */
public class GeneralPatternMetamodelNavigatorLabelProvider extends
		LabelProvider implements ICommonLabelProvider, ITreePathLabelProvider {

	/**
	 * @generated
	 */
	static {
		GeneralPatternMetamodelDiagramEditorPlugin
				.getInstance()
				.getImageRegistry()
				.put("Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
		GeneralPatternMetamodelDiagramEditorPlugin
				.getInstance()
				.getImageRegistry()
				.put("Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	public void updateLabel(ViewerLabel label, TreePath elementPath) {
		Object element = elementPath.getLastSegment();
		if (element instanceof GeneralPatternMetamodelNavigatorItem
				&& !isOwnView(((GeneralPatternMetamodelNavigatorItem) element)
						.getView())) {
			return;
		}
		label.setText(getText(element));
		label.setImage(getImage(element));
	}

	/**
	 * @generated
	 */
	public Image getImage(Object element) {
		if (element instanceof GeneralPatternMetamodelNavigatorGroup) {
			GeneralPatternMetamodelNavigatorGroup group = (GeneralPatternMetamodelNavigatorGroup) element;
			return GeneralPatternMetamodelDiagramEditorPlugin.getInstance()
					.getBundledImage(group.getIcon());
		}

		if (element instanceof GeneralPatternMetamodelNavigatorItem) {
			GeneralPatternMetamodelNavigatorItem navigatorItem = (GeneralPatternMetamodelNavigatorItem) element;
			if (!isOwnView(navigatorItem.getView())) {
				return super.getImage(element);
			}
			return getImage(navigatorItem.getView());
		}

		// Due to plugin.xml content will be called only for "own" views
		if (element instanceof IAdaptable) {
			View view = (View) ((IAdaptable) element).getAdapter(View.class);
			if (view != null && isOwnView(view)) {
				return getImage(view);
			}
		}

		return super.getImage(element);
	}

	/**
	 * @generated
	 */
	public Image getImage(View view) {
		switch (GeneralPatternMetamodelVisualIDRegistry.getVisualID(view)) {
		case ElementMultiplicityEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://generalpattern/1.0?Element?multiplicity", GeneralPatternMetamodelElementTypes.ElementMultiplicity_4013); //$NON-NLS-1$
		case RoleEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Role", GeneralPatternMetamodelElementTypes.Role_3023); //$NON-NLS-1$
		case Connector2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Connector", GeneralPatternMetamodelElementTypes.Connector_3028); //$NON-NLS-1$
		case ConstraintEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Constraint", GeneralPatternMetamodelElementTypes.Constraint_3024); //$NON-NLS-1$
		case ComponentPortDelegatedPortsEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://generalpattern/1.0?ComponentPort?delegatedPorts", GeneralPatternMetamodelElementTypes.ComponentPortDelegatedPorts_4020); //$NON-NLS-1$
		case OverlappingEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Overlapping", GeneralPatternMetamodelElementTypes.Overlapping_3034); //$NON-NLS-1$
		case Overlapping2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://generalpattern/1.0?Overlapping", GeneralPatternMetamodelElementTypes.Overlapping_2027); //$NON-NLS-1$
		case ConnectorEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://generalpattern/1.0?Connector", GeneralPatternMetamodelElementTypes.Connector_2024); //$NON-NLS-1$
		case ComponentPortAttachedRoleEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://generalpattern/1.0?ComponentPort?attachedRole", GeneralPatternMetamodelElementTypes.ComponentPortAttachedRole_4005); //$NON-NLS-1$
		case Role2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://generalpattern/1.0?Role", GeneralPatternMetamodelElementTypes.Role_2025); //$NON-NLS-1$
		case Pattern4EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Pattern", GeneralPatternMetamodelElementTypes.Pattern_3032); //$NON-NLS-1$
		case MultiplicityEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Multiplicity", GeneralPatternMetamodelElementTypes.Multiplicity_3033); //$NON-NLS-1$
		case Pattern2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://generalpattern/1.0?Pattern", GeneralPatternMetamodelElementTypes.Pattern_2022); //$NON-NLS-1$
		case ComponentPortEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?ComponentPort", GeneralPatternMetamodelElementTypes.ComponentPort_3026); //$NON-NLS-1$
		case Stringing2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://generalpattern/1.0?Stringing", GeneralPatternMetamodelElementTypes.Stringing_2028); //$NON-NLS-1$
		case Connector3EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Connector", GeneralPatternMetamodelElementTypes.Connector_3031); //$NON-NLS-1$
		case ConnectorRoleDelegatedRolesEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://generalpattern/1.0?ConnectorRole?delegatedRoles", GeneralPatternMetamodelElementTypes.ConnectorRoleDelegatedRoles_4019); //$NON-NLS-1$
		case MergingOperatorTargetEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://generalpattern/1.0?MergingOperator?target", GeneralPatternMetamodelElementTypes.MergingOperatorTarget_4018); //$NON-NLS-1$
		case MergingOperatorSourceEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://generalpattern/1.0?MergingOperator?source", GeneralPatternMetamodelElementTypes.MergingOperatorSource_4017); //$NON-NLS-1$
		case Component3EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Component", GeneralPatternMetamodelElementTypes.Component_3027); //$NON-NLS-1$
		case ElementRolesEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Link?http://generalpattern/1.0?Element?roles", GeneralPatternMetamodelElementTypes.ElementRoles_4016); //$NON-NLS-1$
		case StringingEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Stringing", GeneralPatternMetamodelElementTypes.Stringing_3035); //$NON-NLS-1$
		case Component2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Component", GeneralPatternMetamodelElementTypes.Component_3025); //$NON-NLS-1$
		case ComponentEditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://generalpattern/1.0?Component", GeneralPatternMetamodelElementTypes.Component_2023); //$NON-NLS-1$
		case ConnectorRoleEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?ConnectorRole", GeneralPatternMetamodelElementTypes.ConnectorRole_3029); //$NON-NLS-1$
		case PatternEditPart.VISUAL_ID:
			return getImage(
					"Navigator?Diagram?http://generalpattern/1.0?Pattern", GeneralPatternMetamodelElementTypes.Pattern_1000); //$NON-NLS-1$
		case Multiplicity2EditPart.VISUAL_ID:
			return getImage(
					"Navigator?TopLevelNode?http://generalpattern/1.0?Multiplicity", GeneralPatternMetamodelElementTypes.Multiplicity_2026); //$NON-NLS-1$
		case Pattern3EditPart.VISUAL_ID:
			return getImage(
					"Navigator?Node?http://generalpattern/1.0?Pattern", GeneralPatternMetamodelElementTypes.Pattern_3030); //$NON-NLS-1$
		}
		return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private Image getImage(String key, IElementType elementType) {
		ImageRegistry imageRegistry = GeneralPatternMetamodelDiagramEditorPlugin
				.getInstance().getImageRegistry();
		Image image = imageRegistry.get(key);
		if (image == null
				&& elementType != null
				&& GeneralPatternMetamodelElementTypes
						.isKnownElementType(elementType)) {
			image = GeneralPatternMetamodelElementTypes.getImage(elementType);
			imageRegistry.put(key, image);
		}

		if (image == null) {
			image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
			imageRegistry.put(key, image);
		}
		return image;
	}

	/**
	 * @generated
	 */
	public String getText(Object element) {
		if (element instanceof GeneralPatternMetamodelNavigatorGroup) {
			GeneralPatternMetamodelNavigatorGroup group = (GeneralPatternMetamodelNavigatorGroup) element;
			return group.getGroupName();
		}

		if (element instanceof GeneralPatternMetamodelNavigatorItem) {
			GeneralPatternMetamodelNavigatorItem navigatorItem = (GeneralPatternMetamodelNavigatorItem) element;
			if (!isOwnView(navigatorItem.getView())) {
				return null;
			}
			return getText(navigatorItem.getView());
		}

		// Due to plugin.xml content will be called only for "own" views
		if (element instanceof IAdaptable) {
			View view = (View) ((IAdaptable) element).getAdapter(View.class);
			if (view != null && isOwnView(view)) {
				return getText(view);
			}
		}

		return super.getText(element);
	}

	/**
	 * @generated
	 */
	public String getText(View view) {
		if (view.getElement() != null && view.getElement().eIsProxy()) {
			return getUnresolvedDomainElementProxyText(view);
		}
		switch (GeneralPatternMetamodelVisualIDRegistry.getVisualID(view)) {
		case ElementMultiplicityEditPart.VISUAL_ID:
			return getElementMultiplicity_4013Text(view);
		case RoleEditPart.VISUAL_ID:
			return getRole_3023Text(view);
		case Connector2EditPart.VISUAL_ID:
			return getConnector_3028Text(view);
		case ConstraintEditPart.VISUAL_ID:
			return getConstraint_3024Text(view);
		case ComponentPortDelegatedPortsEditPart.VISUAL_ID:
			return getComponentPortDelegatedPorts_4020Text(view);
		case OverlappingEditPart.VISUAL_ID:
			return getOverlapping_3034Text(view);
		case Overlapping2EditPart.VISUAL_ID:
			return getOverlapping_2027Text(view);
		case ConnectorEditPart.VISUAL_ID:
			return getConnector_2024Text(view);
		case ComponentPortAttachedRoleEditPart.VISUAL_ID:
			return getComponentPortAttachedRole_4005Text(view);
		case Role2EditPart.VISUAL_ID:
			return getRole_2025Text(view);
		case Pattern4EditPart.VISUAL_ID:
			return getPattern_3032Text(view);
		case MultiplicityEditPart.VISUAL_ID:
			return getMultiplicity_3033Text(view);
		case Pattern2EditPart.VISUAL_ID:
			return getPattern_2022Text(view);
		case ComponentPortEditPart.VISUAL_ID:
			return getComponentPort_3026Text(view);
		case Stringing2EditPart.VISUAL_ID:
			return getStringing_2028Text(view);
		case Connector3EditPart.VISUAL_ID:
			return getConnector_3031Text(view);
		case ConnectorRoleDelegatedRolesEditPart.VISUAL_ID:
			return getConnectorRoleDelegatedRoles_4019Text(view);
		case MergingOperatorTargetEditPart.VISUAL_ID:
			return getMergingOperatorTarget_4018Text(view);
		case MergingOperatorSourceEditPart.VISUAL_ID:
			return getMergingOperatorSource_4017Text(view);
		case Component3EditPart.VISUAL_ID:
			return getComponent_3027Text(view);
		case ElementRolesEditPart.VISUAL_ID:
			return getElementRoles_4016Text(view);
		case StringingEditPart.VISUAL_ID:
			return getStringing_3035Text(view);
		case Component2EditPart.VISUAL_ID:
			return getComponent_3025Text(view);
		case ComponentEditPart.VISUAL_ID:
			return getComponent_2023Text(view);
		case ConnectorRoleEditPart.VISUAL_ID:
			return getConnectorRole_3029Text(view);
		case PatternEditPart.VISUAL_ID:
			return getPattern_1000Text(view);
		case Multiplicity2EditPart.VISUAL_ID:
			return getMultiplicity_2026Text(view);
		case Pattern3EditPart.VISUAL_ID:
			return getPattern_3030Text(view);
		}
		return getUnknownElementText(view);
	}

	/**
	 * @generated
	 */
	private String getElementMultiplicity_4013Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getRole_3023Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Role_3023, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(RoleNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5042); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConnector_3028Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Connector_3028, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(ConnectorName2EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5048); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConstraint_3024Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Constraint_3024, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(ConstraintNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5041); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getComponentPortDelegatedPorts_4020Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getOverlapping_3034Text(View view) {
		Overlapping domainModelElement = (Overlapping) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 3034); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getOverlapping_2027Text(View view) {
		Overlapping domainModelElement = (Overlapping) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 2027); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConnector_2024Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Connector_2024, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(ConnectorNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5053); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getComponentPortAttachedRole_4005Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getRole_2025Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Role_2025, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(RoleName2EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5054); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPattern_3032Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Pattern_3032, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(PatternName3EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5046); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getMultiplicity_3033Text(View view) {
		Multiplicity domainModelElement = (Multiplicity) view.getElement();
		if (domainModelElement != null) {
			return String.valueOf(domainModelElement.getLowerBound());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 3033); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPattern_2022Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Pattern_2022, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(PatternNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5051); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getComponentPort_3026Text(View view) {
		ComponentPort domainModelElement = (ComponentPort) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 3026); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getStringing_2028Text(View view) {
		Stringing domainModelElement = (Stringing) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 2028); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConnector_3031Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Connector_3031, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(ConnectorName3EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5045); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConnectorRoleDelegatedRoles_4019Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getMergingOperatorTarget_4018Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getMergingOperatorSource_4017Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getComponent_3027Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Component_3027, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(ComponentName3EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5049); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getElementRoles_4016Text(View view) {
		return ""; //$NON-NLS-1$
	}

	/**
	 * @generated
	 */
	private String getStringing_3035Text(View view) {
		Stringing domainModelElement = (Stringing) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 3035); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getComponent_3025Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Component_3025, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(ComponentName2EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5050); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getComponent_2023Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Component_2023, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(ComponentNameEditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5052); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getConnectorRole_3029Text(View view) {
		ConnectorRole domainModelElement = (ConnectorRole) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 3029); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPattern_1000Text(View view) {
		Pattern domainModelElement = (Pattern) view.getElement();
		if (domainModelElement != null) {
			return domainModelElement.getName();
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 1000); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getMultiplicity_2026Text(View view) {
		Multiplicity domainModelElement = (Multiplicity) view.getElement();
		if (domainModelElement != null) {
			return String.valueOf(domainModelElement.getLowerBound());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"No domain element for view with visualID = " + 2026); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getPattern_3030Text(View view) {
		IParser parser = GeneralPatternMetamodelParserProvider.getParser(
				GeneralPatternMetamodelElementTypes.Pattern_3030, view
						.getElement() != null ? view.getElement() : view,
				GeneralPatternMetamodelVisualIDRegistry
						.getType(PatternName2EditPart.VISUAL_ID));
		if (parser != null) {
			return parser.getPrintString(new EObjectAdapter(
					view.getElement() != null ? view.getElement() : view),
					ParserOptions.NONE.intValue());
		} else {
			GeneralPatternMetamodelDiagramEditorPlugin.getInstance().logError(
					"Parser was not found for label " + 5047); //$NON-NLS-1$
			return ""; //$NON-NLS-1$
		}
	}

	/**
	 * @generated
	 */
	private String getUnknownElementText(View view) {
		return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
	}

	/**
	 * @generated
	 */
	private String getUnresolvedDomainElementProxyText(View view) {
		return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
	}

	/**
	 * @generated
	 */
	public void init(ICommonContentExtensionSite aConfig) {
	}

	/**
	 * @generated
	 */
	public void restoreState(IMemento aMemento) {
	}

	/**
	 * @generated
	 */
	public void saveState(IMemento aMemento) {
	}

	/**
	 * @generated
	 */
	public String getDescription(Object anElement) {
		return null;
	}

	/**
	 * @generated
	 */
	private boolean isOwnView(View view) {
		return PatternEditPart.MODEL_ID
				.equals(GeneralPatternMetamodelVisualIDRegistry
						.getModelID(view));
	}

}
